package com.zansc.longd.exception;

import com.zansc.longd.model.code.BaseCodeInterface;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServiceException extends RuntimeException {

    protected int errorCode;
    
    protected String errorMsg;
    
    public ServiceException(String msg) {
        super(msg);
        errorMsg = msg;
    }
    
    public ServiceException(BaseCodeInterface baseCodeInterface) {
        super(baseCodeInterface.getResultMsg());
        errorCode = baseCodeInterface.getResultCode();
        errorMsg = baseCodeInterface.getResultMsg();
    }
    
    public ServiceException(BaseCodeInterface baseCodeInterface,String message) {
        super(baseCodeInterface.getResultMsg());
        errorCode = baseCodeInterface.getResultCode();
        errorMsg = message;
    }

}
